<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <div class="container">
            <div class="row clearfix">
                <div class="col-md-12 column">

                    <form role="form" action="/prefundRule/list" method="post">
                    <h1 class="text-center">
                        客户预存款规则
                    </h1>
                    <h3 class="text-right text-success">
                        欢迎您:XXX
                        <#--<@shiro.principal property="name" />-->
                    </h3>

                    <div class="form-group">
                        <div class="col-sm-2">
                            <button type="button" class="btn btn-default btn-block"
                                    value="" style="background-color: cornflowerblue;font-size: large"
                            >筛选查询</button>
                        </div>
                    </div>



                        <div class="container">
                            <div class="row clearfix">
                                <div class="col-md-12 column">
                        <div class="col-md-4 column" style="margin-top: 40px">
                            <div class="form-group">
                                <label for="clientName">规则名称</label>
                                <input type="text" class="form-control"
                                       id="ruleName" name="ruleName" value="${ruleName!}"/>
                            </div>
                        </div>
                        <div class="col-md-6 column" style="margin-top: 65px">
                                <button type="submit" class="btn btn-success"
                                        <#--onclick="accountSubmit()"-->
                                        style="margin-bottom: 10px">查询</button>

                        </div>
                                </div>
                            </div>
                        </div>


                        <#--<h3 class="text-right text-success">-->
                            <#--<button type="submit" class="btn btn-lg btn-block btn-primary"-->
                                    <#-->查询</button>-->
                        <#--</h3 >-->

                    </form>



                    <div class="form-group">
                        <div class="col-sm-2">
                            <button type="button" class="btn btn-default btn-block"
                                    value="" style="background-color: cornflowerblue;font-size: large"
                            >数据列表</button>
                        </div>
                    </div>

                </div>
            </div>
        </div>
                    <#--<h3 class="text-left">-->
                        <#--<button type="button" class="btn btn-info"-->
                                <#--onclick="location.href='/prefundRule/add-ui'" style="float: right">增加</button>-->

                    <div class="container">
                        <div class="row clearfix">
                            <div class="col-md-12 column">


                            <div class="col-sm-offset-6 col-sm-6">
                        <button type="button" class="btn btn-info"
                                onclick="location.href='/prefundRule/add-ui'" style="float: right">增加</button>
                    </div>

                    <table class="table">
                        <thead>
                        <tr>
                            <th>规则名称</th>
                            <th>规则类型</th>
                            <th>适用品牌</th>
                            <th>预存金额</th>
                            <th>赠送金额</th>
                            <th>累计预存款</th>
                            <th>生效时间</th>
                            <th>失效时间</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <#--                    c:forEach items='${pageInfo.list}'  var='trip'-->
                        <#list pageInfo.list as prefundRule>
                            <tr class="info">
                                <td>${prefundRule.ruleName!}</td>
                                <td>${prefundRule.ruleType!}</td>
                                <td>${prefundRule.brand!}</td>
                                  <#if  (prefundRule.prefund??)>
                                     <td>${prefundRule.prefund?c}</td>
                                  </#if>
                                 <#if  (prefundRule.giveFund??)>
                                     <td>${prefundRule.giveFund?c}</td>
                                 </#if>
                                <#--<#if  (prefundRule.totalFund??)>-->
                                 <td>${prefundRule.totalFund?c}</td>
                                <#--</#if>-->


                                <td>
                                     <#if  (prefundRule.beginDate??)>
                                         ${prefundRule.beginDate?string('yyyy-MM-dd')}
                                     </#if>

                                    <#--                                ${trip.startDate?string('yyyy-MM-dd')time} 展示年月日时分秒-->
                                    <#--                                ${trip.startDate?time} 展示时分秒-->
                                </td>
                                <td>
                                       <#if  (prefundRule.endDate??)>
                                           ${prefundRule.endDate?string('yyyy-MM-dd')}
                                       </#if>

                                    <#--                                ${trip.startDate?string('yyyy-MM-dd')time} 展示年月日时分秒-->
                                    <#--                                ${trip.startDate?time} 展示时分秒-->
                                </td>
                                <td>
                                    ${prefundRule.state!}
                                </td>
                                <#--<td>-->
                                    <#--<img style="width: 100px;height: 100px;" src="${trip.tripPic}" />-->
                                <#--</td>-->
                                <td>
                                    <#if prefundRule.state!="已结束" >
                                        <button type="button" class="btn btn-info"
                                          onclick="location.href='/prefundRule/edit-ui?rid=${prefundRule.rid}'">编辑</button>
                                    </#if>


                                    <button type="button" class="btn btn-info"
                                            onclick="location.href='/prefundRule/view?rid=${prefundRule.rid}'">查看</button>
                                    <#if prefundRule.state!="进行中" >
                                        <button type="button" class="btn btn-default btn-danger"
                                                onclick="deleteOne(${prefundRule.rid},this)">删除</button>
                                    </#if>


                                </td>
                            </tr>
                        </#list>

                        </tbody>
                    </table>
                    <ul class="pagination" style="float: right">


                        <#if pageInfo.hasPreviousPage >
                            <li>
                                <a href="javascript:;" onclick="location.href='/prefundRule/list?index=1'">首页</a>
                            </li>

                            <li>
                                <a href="javascript:;" onclick="location.href='/prefundRule/list?index=${pageInfo.prePage}'">上一页</a>
                            </li>
                        </#if>


                        <#if pageInfo.pageNum lt pageInfo.pages >
                            <li>
                                <a href="javascript:;" onclick="location.href='/prefundRule/list?index=${pageInfo.nextPage}'">下一页</a>
                            </li>
                            <li>
                                <a href="javascript:;" onclick="location.href='/prefundRule/list?index=${pageInfo.pages}'">尾页</a>
                            </li>
                        </#if>
                    </ul>
                </div>
            </div>
        </div>
        <script src="/static/js/jquery-1.8.0.min.js" ></script>
        <script>

            // 删除单行信息
            function deleteOne(rid,obj){
                if (confirm("您确定删除该条预存款规则信息吗？")) {
                    //发送AJAX请求
                    $.getJSON(
                        "/prefundRule/delete?rid="+rid,
                        null,
                        function (rs) {
                            if (rs.code==0){
                                //删除成功
                                $(obj).parent().parent().remove();
                            }
                            else {
                                //删除失败
                                alert(rs.msg);
                            }
                        }
                    );
                }
            }


        </script>
    </body>
</html>